<?php
/**
 * User: zhangligang
 * Email: tzhang2450@163.com
 * Date: 2018/9/11
 * Time: 13:43
 */
namespace  App\Console\Commands;

class Tool
{
    /**
     * 写日志
     *
     * @param string $message
     * @param string $fileName
     */
    public static function debug($message = '', $fileName = '')
    {
        $fileName = $fileName ? : date('Y-m-d') . '.debug.log';
        list($time, $ms) = explode('.', microtime(1));
        $time = date('Y-m-d H:i:s ', $time) . $ms;
        error_log('[' . static::getId() . ']['.$time.'] ' . $message . PHP_EOL, 3, './kklogs/' . $fileName);
    }

    /**
     * 获取当前进程操作唯一标识
     *
     * @return number
     */
    public static function getId()
    {
        return uniqid();
    }
}
